import QtQuick 2.9
import QtQuick.Controls 2.2

PageSwitchBase {
    id: c
    anchors.fill: parent


    images:[
        imgPath + "1.bmp",
        imgPath + "2.bmp",
        imgPath + "3.bmp",
    ]

    signal sendMessage(string message)
    Component.onCompleted: {
        sendMessage("Hello from loaded component!")
    }

    property int flag: 0
    onCurrentIndexChanged: {
        console.log("currentIndex:" + currentIndex)
        if(currentIndex !== 0 && flag===0)
            flag = 1
    }

    Item {
        width: 400
        height: 600
        anchors.centerIn: parent
/*
        Image {
            visible: flag
            anchors.fill: parent
            source: images[c.currentIndex]
        }*/


        Repeater {
            model: images
            SLouver {
                anchors.fill: parent
                dir: c.dir
                sourceItem: Image { source: images[index]}
                state: index === c.currentIndex ? "show" : "hide"
            }
        }
    }


}
